package com.yq.ylmall.utils;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Random;


/**
 * @Project: yourlife
 * @Name: OrderCodeUtil
 * @Author: Jack_Li
 * @Date: 2024/6/11 19:52
 */

public class OrderCodeUtil {

    public static synchronized String generateUniqueKey(){
        Random random = new Random();
        // 随机数的量 自由定制，这是9位随机数
        Integer r = random.nextInt(900000000) + 100000000;

        // 返回  13位时间
        Long timeMillis = System.currentTimeMillis();
        return  "YL" + timeMillis + String.valueOf(r);
    }

    public static void main(String[] args) {
        System.out.println(generateUniqueKey());
    }
}
